<?php
@header('Content-type: text/html;charset=UTF-8');
require_once('ly_check.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>站点类型管理</title>
    <link rel="stylesheet" href="../images/css.css" type="text/css"/>
</head>
<body>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="table">
    <tr>
        <td class="bg_tr">&nbsp;站点类型管理</td>
        <td class="bg_tr" style="width:80%;text-align:right;">
            <?php
            if ($_SESSION ["flag"] == 1) {
                ?>
                <span>

<a href="add.php">添加</a>

</span>
            <?php } ?></td>
    </tr>
</table>
<?php
$sql = "select * from countytype order by id asc";
$rs = mysql_query($sql);
$recordcount = mysql_num_rows($rs);
$pagecount = ($recordcount - 1) / $pagesize + 1;
$pagecount = (int)$pagecount;
$pageno = $_GET["pageno"];
if ($pageno < 1) {
    $pageno = 1;
}
if ($pageno > $pagecount) {
    $pageno = $pagecount;
}
$startno = ($pageno - 1) * $pagesize;
$sql = "select * from countytype order by id asc limit $startno,$pagesize";
$rs = mysql_query($sql);
?>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="td_bgf">
    <thead>
    <tr>
        <th>站点类型编号</th>
        <th>站点类型</th>
        <th>类型说明</th>
        <?php
        if ($_SESSION ["flag"] == 1) {
            ?>
            <th>操作</th>
        <?php } ?>
    </tr>
    </thead>
    <tbody>
    <?php
    while ($rows = mysql_fetch_assoc($rs)) {
        ?>
        <tr>
            <td class="td_bg" align="center"><?php echo $rows["countyTypeId"] ?></td>
            <td class="td_bg" align="center"><?php echo $rows["countyTypeName"] ?></td>
            <td class="td_bg" align="center"><?php echo $rows["memo"] ?></td>
            <?php
            if ($_SESSION ["flag"] == 1) {
                ?>
                <td class="td_bg" align="center"><a href="edit.php?id=<?php echo $rows["Id"] ?>"><font
                                color=black>修改</font></a></td>
            <?php } ?>
        </tr>
        <?php
    }
    ?>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="4" align="center" class="bg_tr">
            <?php
            echo "共" . $recordcount . "条记录   ";
            for ($i = 1; $i <= $pagecount; $i++) {
                ?>
                <a href="?pageno=<?php echo $i ?>"><?php echo $i ?></a>
                <?php
            }
            ?>
            <?php
            if ($pageno == 1) {
                if ($pageno == $pagecount) {
                    ?>
                    首页 | 上页 | 下页  | 末页
                    <?php
                } else { ?>
                    首页 | 上页 | <a href="?pageno=<?php echo $pageno + 1 ?>">下页</a> | <a
                            href="?pageno=<?php echo $pagecount ?>">末页</a>
                <?php }
            } else if ($pageno == $pagecount) {
                ?>
                <a href="?pageno=1">首页</a> | <a href="?pageno=<?php echo $pageno - 1 ?>">上页</a> | 下页 | 末页
                <?php
            } else {
                ?>
                <a href="?pageno=1">首页</a> | <a href="?pageno=<?php echo $pageno - 1 ?>">上页</a> | <a
                        href="?pageno=<?php echo $pageno + 1 ?>">下页</a> | <a
                        href="?pageno=<?php echo $pagecount ?>">末页</a>
                <?php
            }
            ?></td>
    </tr>
    </tfoot>
</table>
</body>
</html>
